import os
import sys

# 请在此输入您的代码
import datetime

start = datetime.date(2022,1,1)
end = datetime.date(2022,12,31)



def isTrue(day):
  cnt = 1
  day+='0'
  for i in range(len(day)-1):
    if int(day[i]) == int(day[i+1])-1:
      cnt +=1
    else:
      cnt = 1
    if cnt >= 3:
      return True
    # print(cnt,day[i],day[i+1])
  return False

res = 0
while start <= end:
  s = str(start.year) + '{:>02}'.format(start.month)+'{:>02}'.format(start.day)
  if isTrue(s):
    res+=1
  start += datetime.timedelta(days=1)
# print(isTrue('202234'))
print(res)

res = 0
for i in range(1, 13):
    for j in range(1, 32):
        s = "2022%02d%02d" % (i, j)
        if "012" in s or "123" in s:
            res += 1
print(res)
